#include "CC1101_OK.h"
 
 ELECHOUSE_CC1101 theCC1101;
 byte RX_buffer[61]={0};
 byte size,i,flag;
 byte TX_buffer[61]={10};

 void setup()
{
  Serial.begin(9600);
  theCC1101.Init();
  theCC1101.SetReceive();
  Serial.println("Setup OK.");
  pinMode(13, OUTPUT);
  digitalWrite(13, LOW);
}

void loop()
{
  
  if(theCC1101.CheckReceiveFlag())
  {
    digitalWrite(13, HIGH);
    
    size=theCC1101.ReceiveData(RX_buffer);
    for(i=0;i<size;i++)
    {
      Serial.print(RX_buffer[i],DEC);
      //Serial.print(' ',BYTE);
    }
    Serial.println("");
    
    // Send answer
    theCC1101.SendData(TX_buffer, 6);
    
    theCC1101.SetReceive();

    digitalWrite(13, LOW);

  }
  //delay (100);
  
}

